package com.lottery.im.module.tim.face;

import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import com.lottery.im.R;
import java.io.IOException;

public class DefaultGifEmoji implements Emoji {

  private AssetManager assets;
  private String assetName;
  private String emojiText;

  public DefaultGifEmoji(@NonNull AssetManager assets,
      @NonNull String assetName, @NonNull String emojiText) {
    this.assets = assets;
    this.assetName = assetName;
    this.emojiText = emojiText;
  }


  @Override
  public Drawable getDrawable(Context context) {
    try {
      return new RefreshGifDrawable(assets,assetName);
    } catch (IOException e) {
      e.printStackTrace();
    }
    return ContextCompat.getDrawable(context,getDefaultResId());
  }

  @Override public CharSequence getEmojiText() {
    return emojiText;
  }


  @Override
  public int getDefaultResId() {
    return R.drawable.common_emoj_smile_default;
  }




}
